define(['jquery', 'text!../../Content/upcomingEvents/upcomingEvents.html', 'common', 'knockout'], function($, html, common, ko){

	var container;

	function init(c){
		container = $(c);
		container.html(html);
		loadTeamNav();
		bindEvents();
	}

	function bindEvents(){
		container.on('click', '.datePicker', function(e) {
			e.preventDefault();
			common.publish('calendar/open', true);
		});
	}

	var viewModel = {
		UpcomingEvents : ko.observable()
	};

	function loadTeamNav(){
		common.service('upcomingEvents.json').success(function(data){
			viewModel.UpcomingEvents = data;
			ko.applyBindings(viewModel, container[0]);
		});
	}
	return {
		"init" : init
	};

});